<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>生成预订订单</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<link href="css/css-main.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" href="css/validation/validationEngine.jquery.css" type="text/css"/>
    <link rel="stylesheet" href="css/validation/template.css" type="text/css"/>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script src="js/validation/languages/jquery.validationEngine-zh_CN.js" ></script>
    <script src="js/validation/jquery.validationEngine.js" ></script>
    <link rel=stylesheet type=text/css href="css/msgbox/jquery.msgbox.css" />
<script type="text/javascript" src="js/msgbox/jquery.dragndrop.min.js"></script>
<script type="text/javascript" src="js/msgbox/msgbox.js"></script>
<script type="text/javascript" src="js/common.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
    <script>
		jQuery(document).ready(function(){
			// binds form submission and fields to the validation engine
			jQuery("#formId").validationEngine({
			promptPosition: "centerRight"});
		
 });
   
   /**
    *显示隐藏桌号信息
   **/
  function showTableDiv(divId)
  {
    var tableDiv = document.getElementById(divId);
    
   if(tableDiv.style.display=='block'){
   tableDiv.style.display='none';
   
   }else{
   tableDiv.style.display='block';
   }
  }
  
  /**
    *删除桌号或房间时段
   **/
  function delPeriond(periondType,num)
  {
     if(0==periondType)
     {
        document.getElementById("formId").action = "<%=basePath%>cms/bookinfo/delPreviewPeriod.do?roomNum=" + num ;
		document.getElementById("formId").submit();
     }
     else if(1 == periondType)
     {
       document.getElementById("formId").action = "<%=basePath%>cms/bookinfo/delPreviewPeriod.do?tableNo=" + num ;
	   document.getElementById("formId").submit();
     }
     
  }
  
  function submit(type)
  {
     if(0==type)
     {
        //取消订单
        document.getElementById("formId").action = "<%=basePath%>cms/bookinfo/doCancelPreviewOrder.do?";
		document.getElementById("formId").submit();
     }
     
     if(1==type)
     {
       //提交订单
	   document.getElementById("formId").submit();
     }
  }
  
 </script>

  </head>
  
  <body>
    <div class="main-con"> 
  
  <!--//导航位置层-->
    
      <div class="main-bar"><span class="bar-position">当前位置：<a href="#">客户预订管理</a> &gt;&gt; 客户订单 &gt;&gt; 生成预订订单</span></div>
      <div class="cont_right_cont">
      <form id="formId" action="cms/bookinfo/doAdd.do" method="post">
          <fieldset>
          <legend>客户信息</legend>
          <div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr >
                <td  align="right">预订方式：</td>
                <td nowrap>
                   <select id="orderById" name="bookOrderInfo.orderByInfo.innerIndex"  class="data-searchtxt-time">
	                        <s:iterator value="orderByList"  status="s">
		                        <option value="<s:property value="innerIndex"/>" <s:if test="bookOrderInfo.orderByInfo.innerIndex == innerIndex">selected="selected"</s:if> ><s:property value="orderByName"/></option>
	                        </s:iterator>
                   </select>
                </td>
              </tr>
              <tr>
                <td align="right">客人姓名：</td>
                <td><span style="padding:0px">
                  <input name="bookOrderInfo.customerName" value="<s:property value="bookOrderInfo.customerName" />" type="text" class="data-searchtxt-runtime validate[required, custom[chAndEnChar]]  text-input" id="bookOrderInfo.customerName" size="10" />
                  <font color="red">*</font>
                  </span></td>
              </tr>
              <tr>
                <td align="right">会员卡号：</td>
                <td><span style="padding:0px">
                  <input name="bookOrderInfo.customerInfo.cardNo" value="<s:property value="bookOrderInfo.customerInfo.cardNo" />" type="text" class="data-searchtxt-runtime validate[custom[phone]] text-input"id="bookOrderInfo.customerInfo.cardNo" size="7" />
                  </span></td>
              </tr>
              <tr>
                <td align="right">联系手机：</td>
                <td><span style="padding:0px">
                  <input name="bookOrderInfo.tel"   value="<s:property value="bookOrderInfo.tel" />"  type="text" class="data-searchtxt-runtime validate[required, custom[phone]] text-input"id="bookOrderInfo.tel" size="15" />
                  <font color="red">*</font>
                  </span></td>
              </tr>
               <tr>
                <td align="right">支付方式：</td>
                <td>
                  <select name="bookOrderInfo.paymentMethodsInfo.innerIndex" class="data-searchtxt-select" id="paymentMethodsInfoId" >
                    <s:iterator value="paymentMethodsList"  status="p">
		                <option value="<s:property value="innerIndex"/>" <s:if test="bookOrderInfo.paymentMethodsInfo.innerIndex == innerIndex">selected="selected"</s:if> ><s:property value="paymentName"/></option>
	                 </s:iterator>
                  </select>
                 </td>
              </tr>
              <tr>
                <td align="right">付费状态：</td>
                <td>
                  <select name="bookOrderInfo.payStatus" class="data-searchtxt-select" id="bookOrderInfo.payStatus" >
                    <option value="0" <s:if test="bookOrderInfo.payStatus == 0">selected="selected"</s:if>>未付费</option>
                    <option value="1" <s:if test="bookOrderInfo.payStatus == 1">selected="selected"</s:if>>已付费</option>
                  </select>
                 </td>
              </tr>
              <tr>
                <td align="right">折扣：</td>
                <td><table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td style="padding:0px">
                       <input type="text" class="data-searchtxt-runtime"id="bookOrderInfo.discount" name="bookOrderInfo.discount" value="<s:property value="bookOrderInfo.discount"/>"/></td>
                      <td></td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td align="right">最长保留时常：</td>
                <td><table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td style="padding:0px"><input type="text" class="data-searchtxt-runtime"id="bookOrderInfo.payStatus" /></td>
                      <td>时</td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td align="right">备注：</td>
                <td><span style="padding:0px">
                  <textarea name="bookOrderInfo.description"  cols="40" rows="4" class="data-searchtxt_textarea" id="bookOrderInfo.description"></textarea>
                  </span></td>
              </tr>
              
            </table>
          </div>
        </fieldset>
        <fieldset>
          <legend>订单房间信息</legend>
            
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              
              <tr>
                <td><table width="100%" border="0" class="datalist">
                  <tr>
                   <!--  <th width="4%"><input type="checkbox" name="checkbox" id="checkbox"></th>-->
                    <th nowrap>序号</th>
                    <th nowrap>房间类型</th>
                    <th nowrap>房间号</th>
                    <th>时间</th>
                    <th nowrap>原价</th>
                    <th nowrap>折扣</th>
                    <th nowrap>折扣价</th>
                    <th nowrap width="8%">操作</th>
                  </tr>
                  <!-- 记录为空 -->
						<s:if test=" bookingPreviewRoomsList.size == 0">
						   暂无预订信息
						</s:if>
						<!-- 存在记录 -->
						<s:if test=" bookingPreviewRoomsList.size > 0">
							<!--显示List记录！-->
							<s:iterator value="bookingPreviewRoomsList" status="s">
								<tr>
									<!--  <td>
									  <input type="checkbox" name="innerIndexs" id="innerIndexs" value='<s:property value="innerIndex"/>'>
									</td>-->
									<td nowrap><s:property value="#s.index+1" /></td>
									<td nowrap><s:property value="roomTypeInfo.roomTypeName" /></td>
									<td nowrap>
									<s:if test="(roomTypeInfo.roomTypeId == 6) ||  (roomTypeInfo.roomTypeId == 7)">
									 <a  href="javascript:void(0);" onclick="showTableDiv('<s:property value="roomNum" />')"><s:property value="roomNum" /></a>
									</s:if>
									<s:else>
									  <s:property value="roomNum" />
									</s:else>
									</td>
									<td><s:property value="periodStr" escape="false" /></td>
									<td nowrap><s:property value="originalPricePerRoom" /></td>
									<s:if test="null == bookOrderInfo.customerInfo.clientLevelId">
									 <td nowrap>1.0</td>
									</s:if>
									<s:else>
									<td nowrap><s:property value="bookOrderInfo.customerInfo.clientLevelId.discount" /></td>
									</s:else>
									<s:if test="null == bookOrderInfo.customerInfo.clientLevelId">
									 <td nowrap><s:property value="originalPricePerRoom" /></td>
									</s:if>
									<s:else>
									 <td nowrap><s:property value="discountPrice" /></td>
									</s:else>
									
									<td nowrap><!--  <a href="javascript:void(0);" class="ico_edit"
										onclick="$.toMod(550,335,'修改房间时段','cms/bookinfo/toModPreviewPeriod.do?roomNum=<s:property value="roomNum"/>')">修改</a>
										&nbsp;&nbsp;&nbsp;&nbsp;-->
										<s:if test="(roomTypeInfo.roomTypeId == 6) ||  (roomTypeInfo.roomTypeId == 7)">
										</s:if>
										<s:else>
										  <a class="ico_edit" href="javascript:void(0);" onclick="delPeriond(0,'<s:property value="roomNum"/>');">删除 </a>
										</s:else>
									</td>
								</tr>
								
								<s:if test="(roomTypeInfo.roomTypeId == 6) ||  (roomTypeInfo.roomTypeId == 7)">
								 <tbody id='<s:property value="roomNum" />' style="display:none;" >
                                  <tr>
                                   <th nowrap></th>
                                   <th nowrap>序号</th>
                                   <th nowrap>桌号</th>
                                   <th>时间</th>
                                   <th nowrap>原价</th>
                                   <th nowrap>折扣</th>
                                   <th nowrap>折扣价</th>
                                   <th nowrap>操作</th>
                                  </tr>
								  <s:iterator value="tableNoInfos" status="t">
								    <tr>
								    <td nowrap></td>
								    <td nowrap><s:property value="#t.index+1" /></td>
									<td nowrap><s:property value="tableNo" /></td>
									
									<td ><s:property value="periodStr" escape="false"/></td>
									<td nowrap><s:property value="originalPricePerTable" /></td>
									<s:if test="null == bookOrderInfo.customerInfo.clientLevelId">
									 <td nowrap>1.0</td>
									</s:if>
									<s:else>
									<td nowrap><s:property value="bookOrderInfo.customerInfo.clientLevelId.discount" /></td>
									</s:else>
									<s:if test="null == bookOrderInfo.customerInfo.clientLevelId">
									 <td nowrap><s:property value="originalPricePerTable" /></td>
									</s:if>
									<s:else>
									 <td nowrap><s:property value="discountPrice" /></td>
									</s:else>
									
									<td nowrap><!--  <a href="javascript:void(0);" class="ico_edit"
										onclick="$.toMod(550,335,'修改y预订房间时段','cms/bookinfo/toModPreviewPeriod.do?tableNo=<s:property value="tableNo"/>')">修改</a>
										&nbsp;&nbsp;&nbsp;&nbsp;--><a  class="ico_edit" href="javascript:void(0);" onclick="delPeriond(1,'<s:property value="tableNo"/>');">删除 </a>
									</td>
									</tr>
								  </s:iterator>
								  </tbody>
                                </s:if> 
							</s:iterator>
						</s:if>
                  
                  <tr>
                    <td>&nbsp;</td>
                    <td>合计</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td><s:property value="bookOrderInfo.originalPricePerRoom" /></td>
                    
                        <s:if test="null == bookOrderInfo.customerInfo.clientLevelId">
						 <td nowrap>1.0</td>
						</s:if>
						<s:else>
							<td nowrap><s:property value="bookOrderInfo.customerInfo.clientLevelId.discount" /></td>
						</s:else>
					
                    <td><s:property value="bookOrderInfo.roomTotalPrice" /></td>
                    <td>&nbsp;</td>
                    
                    
                  </tr>
                </table></td>
              </tr>
            </table>
            
          
          
        </fieldset>
          
        
        </form>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
             
              <tr align="center">
                <td align="right">&nbsp;</td>
                <td><input name="button2" type="submit" class="btn-Yes" id="button2" onClick="submit(1)" value="提交订单">
                <input name="button4" type="submit" class="btn-Yes" id="button4" onClick="submit(0)"  value="放弃订单"></td>
              </tr>
            </table>
      </div>
    </div>


  </body>
</html>
